﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Engine.Classes {
    import flash.events.*;
    import flash.display.*;

    public class PackedResourceLoader extends ResourceLoader {

        private var m_assetUrl:String;

        public function PackedResourceLoader(_arg1:String, _arg2:String, _arg3:int=0, _arg4:Function=null, _arg5:Function=null):void{
            this.m_assetUrl = _arg2;
            super(_arg1, _arg3, _arg4, _arg5);
        }
        override public function isPackedResource():Boolean{
            return (true);
        }
        override protected function get retryCount():int{
            if ((m_loader is ZipArchiveLoader)){
                return ((m_loader as ZipArchiveLoader).retryCount);
            };
            return (super.retryCount);
        }
        override protected function set retryCount(_arg1:int):void{
            if ((m_loader is ZipArchiveLoader)){
                (m_loader as ZipArchiveLoader).retryCount = _arg1;
            } else {
                super.retryCount = _arg1;
            };
        }
        override protected function makeLoader():void{
            var _local1:String = this.m_assetUrl;
            if (_local1.lastIndexOf("/") >= 0){
                _local1 = _local1.substr((_local1.lastIndexOf("/") + 1), _local1.length);
            };
            var _local2:String = m_url.substr((m_url.lastIndexOf(".") + 1), m_url.length);
            switch (_local2){
                case "zip":
                    m_loader = new ZipArchiveLoader(_local1);
                    break;
                default:
                    throw (new Error("Unsupported packed resource type"));
            };
        }
        override public function getEventDispatcher():EventDispatcher{
            return ((m_loader as Loader).contentLoaderInfo);
        }
        override protected function logError(_arg1:String, _arg2:int, _arg3:Object):void{
            var _local4:Boolean;
            if ((m_loader is ZipArchiveLoader)){
                _local4 = !((m_loader as ZipArchiveLoader).errorLogged);
                (m_loader as ZipArchiveLoader).errorLogged = true;
            };
            if (_local4){
                super.logError(_arg1, _arg2, _arg3);
            };
        }
        override protected function addEventListeners():void{
            super.addEventListeners();
            m_loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
            m_loader.addEventListener(IOErrorEvent.IO_ERROR, this.onError);
            m_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
        }
        override protected function removeEventListeners():void{
            super.removeEventListeners();
            m_loader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
            m_loader.removeEventListener(IOErrorEvent.IO_ERROR, this.onError);
            m_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
        }
        override protected function onHTTPStatus(_arg1:HTTPStatusEvent):void{
            super.onHTTPStatus(_arg1);
        }
        override protected function onError(_arg1:IOErrorEvent):void{
            super.onError(_arg1);
        }
        override protected function onSecurityError(_arg1:SecurityErrorEvent):void{
            super.onSecurityError(_arg1);
        }

    }
}//package Engine.Classes 
